﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace AliyunOpenSearch4Net.Base
{
    /// <summary>
    /// The base class of api response
    /// </summary>
    public class Response
    {
        /// <summary>
        /// Gets or sets the status.
        /// </summary>
        /// <value>
        /// The status.
        /// </value>
        [JsonProperty("status")]
        public ApiStatus Status { get; set; }

        /// <summary>
        /// Gets or sets the request identifier.
        /// </summary>
        /// <value>
        /// The request identifier.
        /// </value>
        [JsonProperty("RequestId")]
        public string RequestId { get; set; }

        /// <summary>
        /// Gets or sets the errors.
        /// </summary>
        /// <value>
        /// The errors.
        /// </value>
        [JsonProperty("errors")]
        public ApiError[] Errors { get; set; }
    }

    /// <summary>
    /// the basic class for response with result
    /// </summary>
    /// <typeparam name="TResult">The type of the result.</typeparam>
    public class Response<TResult> : Response
    {
        /// <summary>
        /// Gets or sets the result.
        /// </summary>
        /// <value>
        /// The result.
        /// </value>
        [JsonProperty("result")]
        public TResult Result { get; set; }
    }
}
